package com.xyxy.service.impl;

import com.xyxy.dao.UserDao;
import com.xyxy.dao.impl.UserDaoImpl;
import com.xyxy.pojo.User;
import com.xyxy.service.UserService;

public class UserServiceImpl implements UserService {

    UserDao userDao = new UserDaoImpl();

    @Override
    public void registUser(User user) {
        userDao.saveUser(user);
    }

    @Override
    public User login(User user) {
        return userDao.queryUserByUsernameAndPassword(user.getUsername(),user.getPassword());
    }

    @Override
    public boolean isExistsUsername(String username) {
        return (userDao.queryUserByUsername(username) != null);
    }
}
